package com.mls.fivedistrict.server;

import com.baomidou.mybatisplus.plugins.Page;
import com.mls.fivedistrict.common.PageFilter;
import com.mls.fivedistrict.common.ServiceResponse;
import com.mls.fivedistrict.entity.request.ChangePhoneRequest;
import com.mls.fivedistrict.entity.request.TransferAccountRequest;
import com.mls.fivedistrict.entity.request.UpdatePasswordRequest;
import com.mls.fivedistrict.entity.response.SecondInviteDetailResponse;
import com.mls.fivedistrict.pojo.*;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * Created by chenxiuxiang on 2018/3/15.
 */
public interface UserService {
    ServiceResponse addUser(User user, String invitationSourceCode);

    ServiceResponse editUser(User user, Long userId);

    ServiceResponse getUserList(PageFilter pageFilter);

    ServiceResponse getUser(String token);

    ServiceResponse getUser(Long userId);

    ServiceResponse loginByCaptcha(String phone);

    ServiceResponse subscribeUser(User user, String invitationSourceCode);

    ServiceResponse deleteUser(Long userId);

    void transferAsset(TransferAccountRequest transferAccountRequest, String recordSource);

    /**
     * 算力求和
     *
     * @param minParticipationCalculate
     * @return
     */
    ServiceResponse calculateSum(Integer minParticipationCalculate);

    /**
     * 为定时任务提供用户列表
     *
     * @return
     */
    List<User> getUserListForTask(Map filter);

    User getUserDetail(Long id);

    int editUser(User user);

    User getUserByGD(Integer gUserId);


    ServiceResponse addCalculate(Calculate calculate, Long userId);


    /**
     * 获取用户列表不带邀请人数
     *
     * @param pageFilter
     * @return
     */
    List<User> getUserListNomal(PageFilter pageFilter);

    /**
     * 为用户增加资产信息
     *
     * @param record
     * @param userId
     * @return
     */
    ServiceResponse addPropertyForUser(Record record, Long userId);

    /**
     * 获取用户的邀请人列表
     *
     * @param invitorId
     * @param pageFilter
     * @return
     */
    ServiceResponse getInvitorsByUserId(Long invitorId, PageFilter pageFilter);

    /**
     * 查询
     *
     * @param pageFilter
     * @return
     */
    ServiceResponse search(PageFilter pageFilter);

    /**
     * 通过电话号码获取用户信息
     *
     * @param phone
     * @return
     */
    User getUserByPhone(String phone);

    /**
     * 获取用户记录列表，并附带根据积分ID搜索功能
     *
     * @param pageFilter
     * @return
     */
    ServiceResponse getUserRecordList(PageFilter pageFilter);

    /**
     * 获取用户总人数
     *
     * @return
     */
    ServiceResponse getUserTotal();


    /**
     * 获取已经完成国盾区账号绑定的用户数目
     *
     * @return
     */
    ServiceResponse getUserBindSum();

    /**
     * 获取用户算力总量
     *
     * @return
     */
    ServiceResponse getCalculateSum();

    long getMaxId();


    /**
     * 提取资产
     */
    int extract(ExtractEntity extractEntity);

    User getUserById(Long id);


    /**
     * 给其他用户赠送积分
     *
     * @return
     */
    ServiceResponse addIntegralForOtherUser(Long fromUserId, Long targetUserId, Long integralId, BigDecimal value);

    /**
     * 更新用户角色
     *
     * @param roleList
     * @param userId
     * @return
     */
    boolean editUserRole(List<Role> roleList, Long userId);


    /**
     * 更新用户密码
     *
     * @param updatePasswordRequest
     * @return
     */
    int updateUserPassword(UpdatePasswordRequest updatePasswordRequest);

    /**
     * 用户转账
     *
     * @param transferAccountRequest
     * @return
     */
    int userTransferAccounts(TransferAccountRequest transferAccountRequest);

    /**
     * 社区首领奖励积分
     *
     * @param transferAccountRequest
     * @return
     */
    int bonusIntegral(TransferAccountRequest transferAccountRequest);

    /**
     * 修改用户手机号
     *
     * @param changePhoneRequest
     * @return
     */
    int changeUserPhone(ChangePhoneRequest changePhoneRequest);

    /**
     * 根据用户ID获取用户邀请列表
     *
     * @param pageFilter
     * @return
     */
    List<User> getInviteUserList(Long userId, PageFilter pageFilter);

    /**
     * 获取本月邀请的好友人数
     *
     * @param userId
     * @return
     */
    long getCurrentMonthInviteUser(Long userId, PageFilter pageFilter);

    /**
     * 获取二级邀请详情
     *
     * @param userId
     * @return
     */
    SecondInviteDetailResponse getSecondInviteDetail(Long userId);

    /**
     * 通过用户名获取用户
     *
     * @param userName
     * @return
     */
    User getUserByUserName(String userName);


    int updateUser(User newUser, UserExample userExample);

    String login(String userName, String password);

    /**
     * 获取分页信息
     *
     * @param pageFilter
     * @return
     */
    List<UserVoteOption> getVoteUserList(PageFilter pageFilter);

    Long getTodayActivityPersonCount();
}
